home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / ctoolwrk.lbr / GLOBAL.C < prev    next >
Text File  |  1985-09-27  |  512b  |  32 lines

  1. /* This is Global.c  from page 56 */
  2. /*    x is defined as a global variable */
  3.  
  4. #include a:printf.c
  5.  
  6. int x;
  7.  
  8. main()
  9. {
  10.      x = 1;
  11.      printf("x = %d\n",x);
  12.      func1();
  13.      printf("x = %d\n",x);
  14.      func2();
  15.      printf("x = %d\n",x);
  16.      func3();
  17.      printf("x = %d\n",x);
  18.  
  19. }
  20.  
  21. func1()         /* multiply x by 1 */
  22. {
  23.      x = x * 1;
  24. }
  25. func2()         /* multiply x by 2 */
  26. {
  27.      x = x * 2;
  28. }
  29. func3()         /* multiply x by 3 */
  30. {
  31.      x = x * 3;
  32. }